const setMenuShow = (state) => {
  for(let p in state){
    state[p] = false
  }
}

const state = {
  isQian: false,
  isBackstage: false,
  isPlatForm: true
};
const mutations = {
  setBackstage (state) {
    setMenuShow(state)
    const flag = state.isBackstage;
    state.isBackstage = !flag;
  },
  setPlatForm (state) {
    setMenuShow(state)
    const flag = state.isPlatForm;
    state.isPlatForm = !flag;
  },
  setQian (state) {
    setMenuShow(state)
    const flag = state.isQian;
    state.isQian = !flag;
  },
};
const actions = {
  setBackstage ({ commit }, data) {
    commit('setBackstage', data);
  },
  setPlatForm ({ commit }, data) {
    commit('setPlatForm', data);
  },
  setQian ({ commit }, data) {
    commit('setQian', data);
  },
};

export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
